<script>
import defaultConfig from '__CONFIG__/base-config.js'
export default {
  name: 'AuthorBox',
  functional: true,
  render(createElement, context) {
    const {props:{data = {}}, slots} = context
    const {nickname = '', avatar_url = '', motto = ''} = data
    const { ARTICLE_COVER, AVATAR_URL } = defaultConfig
    return (
      <div class="author-box flex">
        <router-link tag="div" class="left-box" to={{name: 'PreviewUser', query:{vertify: nickname}}} style={
          {backgroundImage: `url(${avatar_url || AVATAR_URL})`} 
        }></router-link>
        <div class="right-box" ref="container">
          <div class="author-name">{nickname}</div>
          <div class="author-motto">{motto}</div>
        </div>
        {slots('default').default}
      </div>
    )
  }
}
</script>

<style lang="less">
  @import url('./author_box.less');
</style>